package org.infodavid.common.model;

import java.util.ArrayList;
import java.util.List;


import org.infodavid.common.IBuilder;
import org.infodavid.common.model.components.ILocation;

/**
 * The Class TestUtil.
 */
public class TestUtil {

	/**
	 * Creates the locations.
	 * @param count the count
	 * @return the list
	 * @throws Exception the exception
	 */
	public static List<ILocation> createLocations(final int count) throws Exception {
		final IBuilder<ILocation> builder = ModelFactory.getInstance().getBuilder(ILocation.class);
		final List<ILocation> items = new ArrayList<ILocation>(count);
		ILocation item;
		long key;

		for (int i = 0; i < count; i++) {
			item = builder.create();
			key = System.nanoTime();

			item.setAddress("address-" + key);
			item.setComment("comment-" + key);
			item.setCity("city-" + key);
			item.setType(ILocation.ELocationType.OTHER);
			item.setCountry("FR");
			item.setZipCode("75000");

			items.add(item);
		}

		return items;
	}
}
